/********************************************************
 * Filename: TUnitTestSuite.java
 * Author: LMU
 * Program: TUnit
 * Description: The TUnit test suite.        
 * Revision History:
 * 20060905: Initial Revision.
 * 20060906: Added the TUnitProjectTest case.  
 * 20060907: Added the TUnitPackageTest case.
 * 20060914: Added more tests.    
 * *****************************************************/

package edu.lmu.cs.tUnit.test;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;

import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestSuite;

public class TUnitTestSuite {

	public static Test suite() {
		TestSuite suite = new TestSuite("TUnit test suite");
		suite.addTest(new TestSuite(TUnitPerspectiveTest.class));
		suite.addTest(new TestSuite(TUnitProjectTest.class));
		suite.addTest(new TestSuite(TUnitPackageTest.class));
		suite.addTest(new TestSuite(TUnitFileTest.class));
		suite.addTest(new TestSuite(TUnitExecuteTest.class));
		suite.addTest(new TestSuite(TUnitNamespaceViewTest.class));
		suite.addTest(new TestSuite(TUnitEditorTest.class));
		TestSetup wrapper = new TestSetup(suite) {
			protected void tearDown() throws CoreException {
				oneTimeTearDown();
			}
		};

		return wrapper;
	}

	public static void oneTimeTearDown() throws CoreException {
		// one-time cleanup code
		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		IProject tUnitProject = root.getProject("TUnitProjectTest2");
		tUnitProject.delete(true, true, null);
	}
}
	